04. Feature Engineering: Transforming Raw Data into Predictive Variables

Part 1 - Data Formatting

PRTDM2-785 AI Trading C2 L1 Vid4 Formatting

Efficient Data Preprocessing for Reusable Code

Ensuring consistency in data formats is vital for creating reusable code. This is especially important when dealing with multiple datasets that label similar columns differently, like "date" versus "date time."

Key Strategies for Data Preprocessing:

  • Standardize Labels: Ensure all datasets use consistent column names for uniform processing.

  • **Address Missing Data: ** Missing values need careful handling. Incorporate strategies such as:

    • Imputation: Fill in missing data with expected values if applicable.
    • Dummy Variables: Use when missing information itself holds significance, like no dividends paid by a company.
  • Standardize Formatting: Correct typos and ensure uniform data presentation, especially in structured data like dates and names.

  • Data Extraction: Use tools like regex to parse specific information (e.g., extracting zip codes).

  • Consistent Time Series Handling: Align datasets with different temporal resolutions by resampling; choose between downsampling and upsampling according to need.

By incorporating these methods, seamless data preprocessing is achieved, facilitating effective data analysis and modeling.

Part 2 - Feature Engineering

PRTDM2-785 AI Trading C2 L1 Vid5 Feature Engineering

Understanding Feature Engineering for Financial Data

  • Pre-requisite: Data should be formatted correctly, and errors corrected.

  • Feature Engineering Defined: It involves creating new dataset attributes using existing columns.

  • Examples in Finance:

    • Debt to Equity Ratio: Ratio of total debt to shareholders’ equity.
    • Return on Equity (ROE): Net income divided by shareholders’ equity.
    • Interest Coverage Ratio: EBITDA compared to interest expenses.
  • Importance:

    • Essential for building successful models.
    • Enhances data usability for different algorithms.
  • Algorithm-Specific Features:

    • Some algorithms prefer categorical data, e.g., default flags.
    • Others need continuous data, e.g., total balance outstanding.
  • Relationship Impact:

    • Algorithms leverage input data variability.
    • Feature engineering reshapes relationships to better suit specific algorithms.
  • Model Compatibility:

    • Linear models need linear input-output relationships.
    • Adjust features to ensure correct relationship learning.

Successful feature engineering unlocks the potential of financial data by aligning data attributes with algorithm requirements, enhancing model predictions.

What's the difference between a predictive and explanatory machine learning model?

SOLUTION: A predictive model focuses on accurately predicting future outcomes, while an explanatory model focuses on understanding the relationships between variables.

Which of the following does NOT count as a type of feature engineering?

SOLUTION: Splitting the data into training and test sets.